#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:fei time:2019/8/16 19:32

from django import forms
from ..verifications import constants

class RegisterForm(forms.Form):
    """用户注册表单"""
    username = forms.CharField(label='用户名', max_length=20, min_length=5, error_messages={
        "min_length": "用户名长度要大于5",
        "max_length": "用户名长度要小于20",
        "required": "用户名不能为空"})
    password = forms.CharField(label='密码', max_length=8, min_length=6, error_messages={
        "min_length": "密码长度要大于6",
        "max_length": "密码长度要小于8",
        "required": "密码不能为空"})
    password_repeat = forms.CharField(label='确认密码', max_length=8, min_length=6, error_messages={
        "min_length": "密码长度要大于6",
        "max_length": "密码长度要小于8",
        "required": "密码不能为空"})
    mobile = forms.CharField(label='手机号码', max_length=11, min_length=11, error_messages={
         "min_length": "手机号长度有误",
         "max_length": "手机号长度有误",
         "required": "手机号不能为空"})
    sms_code = forms.CharField(label="短信验证码", max_length=constants.SMS_CODE_LENGTH, min_length=constants.SMS_CODE_LENGTH, error_messages={
        "min_length": "短信验证码长度有误",
        "max_length": "短信验证码长度有误",
        "required": "短信验证码不能为空",
    })

